<?php
/**
 * Created by PhpStorm.
 * User: fangwei
 * Date: 2019-08-06
 * Time: 23:24
 */

namespace App\Http\Controllers\Admin\View;


use App\Http\Controllers\Controller;
use App\Http\Repositories\Services\IClient;
use App\Http\Repositories\Services\IClientVisit;

class ClientVisitController extends Controller
{
    protected $clientVisitService;
    protected $clientService;

    public function __construct(
        IClientVisit $clientVisitService,
        IClient $clientService
    )
    {
        $this->clientVisitService = $clientVisitService;
        $this->clientService = $clientService;
    }

    public function index(){
        return view('admin.clientVisit.index');
    }

    public function store($id){
        $dao = $this->clientService->byId($id);
        $client_name = $dao->name;
        return view('admin.clientVisit.create',compact('id','client_name'));
    }

    public function update($id){
        $dao = $this->clientVisitService->byId($id);
        return view('admin.clientVisit.edit',['dao'=>$dao]);
    }
}